package cc.wsyw126.java.lambda.java8lambda.MyPractice.chapter4;

import org.junit.Assert;
import org.junit.Test;

/**
 * Created by junpeng.yang on 16/9/12.
 */
public class TestForChapter4 {
    @Test
    public void ChildOverrwideDefault() {
        Child child = new ChildImpl();
        child.welcome();
        Assert.assertEquals(Chapter4Constants.childBody, child.getLastMessage());
    }

    @Test
    public void concreteBeatsDefault() {
        Parent parent = new OverridingParen();
        parent.welcome();
        Assert.assertEquals(Chapter4Constants.parentBody, parent.getLastMessage());
    }

    @Test
    public void concreteBeatsCloserDefault() {
        OverridingChild parent = new OverridingChild();
        parent.welcome();
        Assert.assertEquals(Chapter4Constants.parentBody, parent.getLastMessage());
    }
}
